﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

namespace Server.Services
{
    public class CustomServiceHost : ServiceHost
    {
        public CustomServiceHost(Controller controller, Type serviceType, params Uri[] baseAddresses)
            : base(serviceType, baseAddresses)
        {

            if (controller == null)
            {
                throw new ArgumentNullException("Controller");
            }

            foreach (var cd in this.ImplementedContracts.Values)
            {
                cd.Behaviors.Add(new CustomInstanceProvider(controller));
            }
        }
    }
}
